<template>
  <div>

    <Row>
      <i-col span="24" class-name="y_query_right">
        <Button type="primary" class="y_condition" icon="md-pricetag" @click="showCoupon"
                :disabled="!this.status.showCouponEnable&&(searchParams.selectedUsers.length <= 0)" v-has=tRole.COUPONS_2_202>发放优惠券</Button>
      </i-col>
    </Row>
    <divider></divider>

    <Row >
      <i-col class-name="y_query_right" span="24" v-has=tRole.USER_1_100 >
          <Input v-model.trim="searchParams.userName" placeholder="必须输入用户全称" clearable class="y_condition"></Input>
          <Select placeholder="标签" v-model="searchParams.tabId" class="y_condition" style="text-align: left;"
                  clearable filterable allow-create @on-clear="searchParams.tabId=null" >
            <Option v-for="tag in tData.tabList" :value="tag.id">{{ tag.name }}</Option>
          </Select>

          <DatePicker  type="datetime" v-model="searchParams.startTime" format="yyyy-MM-dd HH:mm" style="min-width: 150px" class="y_condition"></DatePicker> -
          <DatePicker type="datetime" v-model="searchParams.endTime" format="yyyy-MM-dd HH:mm"  class="y_condition"></DatePicker>
          <Button type="primary" class="y_condition" icon="md-search" @click="search">查询</Button>


      </i-col>
    </Row>

    <!--表格和分页-->
<!--    <Table stripe border ref="userInfo" :columns="tableTitles" @on-sort-change="sortChange" :data="userList" class="table_css"-->
<!--           no-data-text="暂无数据" @on-selection-change="userSelectedChanged" ></Table>-->

    <List size="small" border style="margin:0.5rem;text-align: left">
      <div v-if="userList==null || userList.length==0">
        <ListItem>
          <div style="width: 100%; text-align: center;">暂无数据</div>
        </ListItem>
      </div>
      <div v-else>
        <ListItem >
          <Checkbox v-model="isCheckedAll" @on-change="handleCheckAll">全选</Checkbox>
          <ListSort sort-label="订单量" :sort-by="searchParams.orderBy" sort-value="user_order_count" @change="sortChangeList"></ListSort>
          <ListSort sort-label="购物车" :sort-by="searchParams.orderBy" sort-value="user_cart_count" @change="sortChangeList"></ListSort>
        </ListItem>
        <CheckboxGroup v-model="searchParams.selectedUsers" @on-change="checkChange">
        <ListItem v-for="(item,index) in userList" class="item_hover">
          <i-col flex="auto">
            <div style="display: flex">
              <Checkbox :label="item.id" :value="item.id">{{ check }}</Checkbox>
              <div style="display: flex">
                <img :src="item.avatar!=null&&item.avatar!=''?item.avatar:'https://d1ww9fdmfwkmlf.cloudfront.net/avatar/avatar.jpg'" style="height: 64px"
                     @click="status.modalImage.url = item.avatar!=null&&item.avatar!=''?item.avatar:'https://d1ww9fdmfwkmlf.cloudfront.net/avatar/avatar.jpg';
                     status.modalImage.isShow = true;"/>
                <div style="padding-left:10px">
                <div v-if="$authority('USER-1-210')">
                  <a style="padding:6px;font-size:13px" @click="showUserInfo(index)">
                    {{item.encodeName}}
                  </a>
                </div>
                <div v-else>
                  <span v-text="item.encodeName"></span>

                </div>

                  <KeyValueView title="注册时间" oneline >
                    <span v-text="$tiyBJTime(item.registertime)"></span>
                    <tag v-if="item.tabsName!=''&&item.tabsName!=null" color="blue" style="margin-left: 0.5rem">{{item.tabsName}}</tag>
                  </KeyValueView>

                  <KeyValueView title="状态"  >
                    <badge :status="item.state==110?'default':'success'" :text="userDisplayState(item.state)" />
                  </KeyValueView>
                <KeyValueView title="国家" v-if="$authority('USER-1-202')"  >
                  {{item.country}}
                </KeyValueView>
                  <KeyValueView title="注册方式"  online>
                    <span  v-text="registerType(item.thirdParty)"></span>
                  </KeyValueView>
                  <KeyValueView title="订单" v-if="$authority('USER-1-205')"  online >
                    <a v-if="$authority('USER-1-211')&&item.userOrderCount!=0" style="padding:6px;font-size:0.9rem;color:#448aff;font-weight:600" @click="showOrder(index)">
                      {{item.userOrderCount}}
                    </a>
                    <span v-else>{{item.userOrderCount}}</span>
                  </KeyValueView>
                  <KeyValueView title="购物车" v-if="$authority('USER-1-206')"   >
                      <a v-if="$authority('USER-1-212') && item.userCartCount!=0"  style="padding:6px;font-size:0.9rem;color:#448aff;font-weight:600" @click="showCart(index)">
                        {{item.userCartCount}}
                      </a>
                    <span v-else>{{item.userCartCount}}</span>
                  </KeyValueView>

                </div>
              </div>
            </div>
          </i-col>
          <i-col >
            <div class="item_bottom" style="padding: 0.5rem " >
                <i-button v-if="$authority('USER-1-209')" type="primary" size="small"   @click="showRecordList(item.id)">查看登录记录</i-button>
            </div>
          </i-col>
        </ListItem>
        </CheckboxGroup>
      </div>
    </List>


    <div style="float: right;">
      <Page :total="tPage.total" :page-size="tPage.stepNumber" :current="tPage.currentPage" @on-change="changePage"
            @on-page-size-change="sizeChange" :page-size-opts="[40,60,80]"
            show-sizer show-elevator/>
    </div>
    <!--order弹出框-->
    <Modal
      v-model="status.modalOrder.isShow"
      title="查看订单"
      :styles="{top: '20px',bottom:'20px',width:'80%',}"
      :scrollable=false>
      <!--表格和分页-->
<!--      <Table stripe border :context="this" :columns="tableOrderTitles" :data="orderList" class="table_css"-->
<!--             no-data-text="暂无数据" ></Table>-->
      <List size="small" border style="margin:0.5rem;text-align: left">
        <div v-if="orderList==null || orderList.length==0">
          <ListItem>
            <div style="width: 100%; text-align: center;">暂无数据</div>
          </ListItem>
        </div>
        <div v-else>
          <ListItem v-for="(item,index) in orderList" class="item_hover">
            <i-col flex="auto">
              <div style="display: flex">
                <div style="display: flex">
                  <div style="padding-left:10px">
                    <KeyValueView title="编号"  >
                      {{index}}
                    </KeyValueView>
                    <KeyValueView title="订单号"  >
                      <a style="padding:6px;font-size:13px;color:#448aff" @click="getOrderDetail(item.id)" >
                        {{item.serialNumber}}
                      </a>
                    </KeyValueView>
                    <KeyValueView title="国家"  >
                      {{item.countryName}}
                    </KeyValueView>
                    <KeyValueView title="金额($)"  online>
                      {{item.actualPayment}}
                    </KeyValueView>
                    <KeyValueView title="下单时间"  >
                      {{$tiyBJTime(item.createtime)}}
                    </KeyValueView>

                    <KeyValueView title="订单状态"   >
                      {{$getDictLabel('orderStateDict',item.state)}}
                    </KeyValueView>

                  </div>
                </div>
              </div>
            </i-col>
          </ListItem>
        </div>
      </List>
      <Page :total="searchParams.showOrder.total" :page-size="searchParams.showOrder.pageSize"
            :current="searchParams.showOrder.pageNum" @on-change="changeOrderPage"
            show-elevator/>
    </Modal>
    <!--cart弹出框-->
    <Modal
      v-model="status.modalCart.isShow"
      title="查看购物车"
      :styles="{top: '20px',bottom:'20px',width:'80%',}">

      <!--表格和分页-->
      <List size="small" border style="margin:0.5rem;text-align: left">
        <div v-if="cartList==null || cartList.length==0">
          <ListItem>
            <div style="width: 100%; text-align: center;">暂无数据</div>
          </ListItem>
        </div>
        <div v-else>
          <ListItem>
            <b>总重量:{{tData.cartWeightCount}}<span class="info_key">({{tData.cartWeightCount|numFilter}})</span></b>&nbsp;&nbsp;&nbsp;&nbsp;
            <b>总金额:{{tData.cartPriceCount}}</b>
          </ListItem>
          <ListItem v-for="(item,index) in cartList" class="item_hover">
            <i-col flex="auto">
              <div style="display: flex">
                <div style="display: flex">
                  <div style="padding-left:10px">
                    <div style="display: flex">
                      <img :src="$store.getters.imgPrefix+item.productImgUrl" height="60" @click="showProductImage(item.productImgUrl)" />
                      <div style="margin-left: .5rem">
                        <i-col>
                          <a target="_blank"  :href="$tiyProductUrl(item.productCode)" >
                            {{item.productCode}}
                          </a>
                        </i-col>
                        <KeyValueView title="色卡/尺码"  online>
                          {{item.color+'/'+item.sizeName}}
                        </KeyValueView>

                        <KeyValueView title="当前售价($)"  >
                          {{item.price}}
                        </KeyValueView>
                        <KeyValueView title="数量"  >
                          {{item.amount}}
                        </KeyValueView>
                        <KeyValueView title="重量(g)"  >
                          {{item.weight}}
                        </KeyValueView>
                        <i-col>
                          <KeyValueView title="添加时间"  online >
                            {{$tiyBJTime(item.createtime)}}
                          </KeyValueView>
                        </i-col>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </i-col>
          </ListItem>
        </div>
      </List>

      <div style="text-align: left;">
        <Page :total="searchInfoPage.total" :page-size="searchInfoPage.stepNumber" :current="searchInfoPage.currentPage"
              @on-change="cartChangePage"  show-elevator/>
      </div>
    </Modal>

    <Modal
      v-model="status.modalUserInfo.isShow"
      title="用户详情"
      :styles="{top: '20px',bottom:'20px',width:'50%'}"
      :scrollable=false >
      <row style="font-size:14px">
        <i-col span="4" class="tiy_key" >First Name :</i-col>
        <i-col span="8">{{searchParams.showUserInfo.firstName}}</i-col>
        <i-col span="4" class="tiy_key">Last Name :</i-col>
        <i-col span="8">{{searchParams.showUserInfo.lastName}}</i-col>
      </row>
      <row style="font-size:14px">
        <i-col span="4" class="tiy_key" >国家 :</i-col>
        <i-col span="8">{{searchParams.showUserInfo.country}}</i-col>
        <i-col span="4" class="tiy_key" v-if="searchParams.showUserInfo.source">下载来源:</i-col>
        <i-col span="8" v-if="searchParams.showUserInfo.source" >{{searchParams.showUserInfo.source}}</i-col>
      </row>
      <row style="font-size:14px">
        <i-col span="4" class="tiy_key" v-if="searchParams.showUserInfo.inviteCode">邀请码:</i-col>
        <i-col span="8" v-if="searchParams.showUserInfo.inviteCode">{{searchParams.showUserInfo.inviteCode}}</i-col>
        <i-col span="4"  class="tiy_key" v-if="searchParams.showUserInfo.useContent">采购用途:</i-col>
        <i-col span="8" v-if="searchParams.showUserInfo.useContent">{{searchParams.showUserInfo.useContent}}</i-col>
      </row>
      <row style="font-size:14px">
        <div class="modal_base_div">
          <div class="modal_base_div_title" style="margin-top: 1rem"><strong>用户标签 :</strong></div>
          <i-col :span="24" align="left">
            <Select v-model="searchParams.showUserInfo.tabList"  style="width: 15rem;margin-left: 1.5rem;margin-top: 0.5rem;" filterable multiple  placeholder="用户标签">
              <Option v-for="item in tData.tabList" :value="item.id" :key="item.id">{{ item.name }}</Option>
            </Select>
            <Button type="info" style="margin-left: 0.5rem;margin-top: 0.5rem;" @click="saveUserTab()">保存</Button>
          </i-col>
        </div>

      </row>
      <div slot="footer">
        <Button type="primary" @click="claimUser" v-if="searchParams.showUserInfo.hasEmployee == false"  v-has=tRole.USER_1_215>认领</Button>
        <Button type="primary" v-if="searchParams.showUserInfo.hasEmployee == false" @click="showAssign" v-has=tRole.USER_1_216>指派</Button>
        <Button type="info" @click="status.modalUserInfo.isShow = false;">关闭</Button>
      </div>
    </Modal>

    <!-- 发送邮件 -->
    <Modal
      v-model="showEmailState.isShowing"
      title=""
      :mask-closable="false"
      :styles="{top: '20px',bottom:'20px',width:'80%'}">
      <send-email v-bind:receiveUser="showEmailState.selectedUsers" v-bind:isRefresh="showEmailState.isShowing"
                       v-on:listenSendEmailEvent="sendSuccess" :is-send="false"  ref="SendEmail"></send-email>
      <div slot="footer"></div>
    </Modal>

    <TiyPhotoView v-model="status.modalImage.isShow" :tiy-photo="status.modalImage.url"></TiyPhotoView>

    <!--优惠券发放弹出框-->
    <Modal v-model="status.modalDistuibuteCoupon.isShow" title="发放优惠券"
      :styles="{top: '20px',bottom:'20px',width:'50%',}" :scrollable=false @on-ok="confirmDistributeCoupon()" ok-text="发放">
      <!--表格和分页-->
      <RadioGroup v-model="searchParams.selectedCoupon" vertical >
        <Radio :label="item" v-for="item in status.modalDistuibuteCoupon.couponDefines">{{item.title}}</Radio>
      </RadioGroup>
      <row v-if="searchParams.selectedCoupon.id">
        <div class="modal_base_div">
          <div class="modal_base_div_title" style="margin-top: 1rem"><strong>优惠券详情 :</strong></div>
          <row style="font-size:14px">
            <i-col span="4" class="tiy_key">类型:</i-col>
            <i-col span="8">{{couponTypeDict.filter(item=>item.value==searchParams.selectedCoupon.type)[0].name}}</i-col>
            <i-col span="4" class="tiy_key">有效期:</i-col>
            <i-col span="8" v-if="searchParams.selectedCoupon.validityPeriodType == 1 && searchParams.selectedCoupon.effectiveTime">
              {{new Date(searchParams.selectedCoupon.validityPeriod+searchParams.selectedCoupon.effectiveTime).toLocaleString()}}截止
            </i-col>
            <i-col span="8" v-else-if="searchParams.selectedCoupon.validityPeriodType == 1 && !searchParams.selectedCoupon.effectiveTime">
              发放后{{searchParams.selectedCoupon.validityPeriod/24/3600/1000}}天内有效
            </i-col>
            <i-col span="8" v-else-if="searchParams.selectedCoupon.validityPeriodType == 2">当月有效</i-col>
          </row>
          <row style="font-size:14px">
            <i-col span="4"  class="tiy_key">使用门槛:</i-col>
            <i-col span="8">{{"$"+searchParams.selectedCoupon.threshold}}</i-col>
            <i-col span="4" class="tiy_key" v-if="searchParams.selectedCoupon.type == 100">优惠金额:</i-col>
            <i-col span="8" v-if="searchParams.selectedCoupon.type == 100">{{"$"+searchParams.selectedCoupon.faceValue}}</i-col>
            <i-col span="4" class="tiy_key" v-if="searchParams.selectedCoupon.type == 200">折扣比率:</i-col>
            <i-col span="8" v-if="searchParams.selectedCoupon.type == 200">{{100-searchParams.selectedCoupon.discountRate*100+"%"}}</i-col>
          </row>
        </div>
      </row>
    </Modal>

    <!--用户分配窗口-->
    <Modal v-model="status.modalAssignUser.isShow" title="选择推广员"
           :styles="{top: '20px',bottom:'20px',width:'40%',}" :scrollable=false @on-ok="assignToEmployee()" ok-text="分配">
      <!--表格和分页-->
      <Row >
        <i-col span="4">&nbsp;</i-col>
        <i-col span="16">
          <SearchEmployee @chooseEmployee="chooseEmployee"/>
        </i-col>
        <i-col span="4">&nbsp;</i-col>
      </Row>
    </Modal>

    <UserLoginRecord :user-id="loginRecord.selectedUserId" v-model="loginRecord.showRecordDialog"></UserLoginRecord>
  </div>

</template>

<!--javascript 代码-->
<script>
  import ICol from "../../../node_modules/view-design/src/components/grid/col"
  import SendEmail from "../email/SendEmailTemplate.vue"
  import tiyData from "./js/userSearch/user_search_data"
  import KeyValueView from "../widgets/KeyValueView";
  import ListSort from "../widgets/ListSort";
  import UserLoginRecord from "./UserLoginRecord";
  import {
    init,
    webList,
    webOrderList,
    webCartList,
    webRecordList,
    userInfo,
    getCouponDefine,
    distributeCoupon,
    queryUsersOfCurrentEmployee,
    assignUserToEmployee
  } from "./js/userSearch/user_search_funs"
  import TiyPhotoView from "../widgets/TiyPhotoView";
  import SearchEmployee from "../widgets/SearchEmployee";
  import Vue from "vue";

  export default {
    components: {TiyPhotoView, ICol,SendEmail,SearchEmployee,KeyValueView,ListSort,UserLoginRecord},
    data(){
      return {
        tRole:{
          USER_1_100:'USER-1-100',
          USER_1_215:'USER-1-215',
          USER_1_216:'USER-1-216',
          COUPONS_2_202:"COUPONS-2-202"
        },
        tPage: tiyData.tPage,
        searchInfoPage: tiyData.searchInfoPage,
        status: tiyData.tStatus,
        tabDetail:'',

        //搜索条件
        searchParams: tiyData.tParams,
        tData :tiyData.tData,
        userList: tiyData.tData.userList,
        orderList: tiyData.tData.orderList,
        cartList: tiyData.tData.cartList,
        recordList: tiyData.tData.recordList,
        dateRange: tiyData.tData.dateRange,
        loginTypeDict: this.$store.getters.dictionaries.loginTypeDict,
        orderItemDict: this.$store.getters.dictionaries.orderStateDict,
        couponTypeDict:this.$store.getters.dictionaries.couponType,
        tableTitles: tiyData.userTableTitles(this),
        tableOrderTitles: tiyData.orderTableTitles(this),
        tableCartTitles: tiyData.cartTableTitles(this),
        tableAddressTitles: tiyData.addressTableTitles,
        tableRecordTitles:tiyData.recordTableTitles(this),
        showEmailState:{// 发送邮件相关的状态
          isShowing:false,
          selectedUsers:[],
        },
        isCheckedAll: false,
        loginRecord:{
          showRecordDialog:false,
          selectedUserId:''
        }

      }

    },
    computed : {

    },
    methods: {

      cartChangePage(page) {
        tiyData.searchInfoPage.currentPage = page;
        webCartList(this, tiyData);
      },
      search(){
        if(this.searchParams.userName){
            webList(this, tiyData);
        } else {
            queryUsersOfCurrentEmployee(this, tiyData);
        }
      },
      showOrder(index){
        tiyData.tParams.showOrder.userId = tiyData.tData.userList[index].id;
        webOrderList(this, tiyData);
      },
      showCart(index){
        tiyData.tParams.showCart.userId = tiyData.tData.userList[index].id;
        webCartList(this, tiyData);
      },
      showRecord(index){
        tiyData.tParams.showRecord.userId = tiyData.tData.userList[index].id;
        webRecordList(this, tiyData);
      },
      changePage(page){
        tiyData.tPage.currentPage = page;
        webList(this, tiyData);
      },
      sizeChange(p){
        tiyData.tPage.stepNumber = p;
        webList(this, tiyData);
      },
      sortChange(column){
        tiyData.tPage.total = 1;
        tiyData.tPage.startIndex = 0;
        tiyData.tPage.stepNumber = 20;
        tiyData.tPage.currentPage = 1;
        if('normal' == column.order){
          tiyData.tParams.orderBy = '';
        }else{
          tiyData.tParams.orderBy = column.key +' '+ column.order;
        }
        webList(this,tiyData);
      },
      sortChangeList(sortBy){
        tiyData.tPage.total = 1;
        tiyData.tPage.startIndex = 0;
        tiyData.tPage.stepNumber = 20;
        tiyData.tPage.currentPage = 1;
        tiyData.tParams.orderBy = sortBy;
        // if('normal' == column.order){
        //   tiyData.tParams.orderBy = '';
        // }else{
        //   tiyData.tParams.orderBy = column.key +' '+ column.order;
        // }
        webList(this,tiyData);
      },
      chooseDate(date){
        tiyData.tParams.startEndDate = date;
      },
      changeRecordPage(page){
        tiyData.tParams.showRecord.pageNum = page;
        webRecordList(this, tiyData);
      },
      showUserInfo(index){

        userInfo(this,tiyData,index);
      },
      showEmail(index){
        this.showEmailState.selectedUsers.length = 0;
        let selectUser=tiyData.tData.userList[index];
        let user = {
          "id": selectUser.id,
          "encodeName": selectUser.encodeName,
          "contactEmail":selectUser.virtualName,
        };
        this.showEmailState.selectedUsers.push(user);
        this.showEmailState.isShowing = true;
      },
      sendSuccess(isSuccess){
        if(isSuccess){
          this.showEmailState.isShowing = false;
        }
      },
      userSelectedChanged(selection){
          tiyData.tParams.selectedUsers = selection;
          if(tiyData.tParams.selectedUsers.length > 0){
              this.status.showCouponEnable = true;
          } else {
              this.status.showCouponEnable = false;
          }
      },
      showCoupon(){
          tiyData.tParams.selectedCoupon = {};
          if(!tiyData.tParams.selectedUsers || tiyData.tParams.selectedUsers.length <= 0){
              this.$Modal.error({
                  title: "error",
                  content: "请先选择发放优惠券的用户！"
              });
              return;
          }
          getCouponDefine(this, tiyData);
      },
      confirmDistributeCoupon(){
          if(!tiyData.tParams.selectedCoupon.id){
              this.$Modal.error({
                  title: "error",
                  content: "请先选择优惠券！"
              });
              return;
          }
          distributeCoupon(this, tiyData);
      },
      claimUser(){ //当前登录员工认领此用户
          let assignData = tiyData.tParams.assignUser;
          assignData.userId = this.searchParams.showUserInfo.userId;
          assignData.userName = this.searchParams.showUserInfo.fullName;
          assignData.isCurrentEmployee = true;
          tiyData.tParams.assignUser.employeeId = "";
          assignUserToEmployee(this, tiyData, true);
      },
      showAssign(){ //显示分配用户窗口
          tiyData.tStatus.modalAssignUser.isShow = true;
          let assignData = tiyData.tParams.assignUser;
          assignData.userId = this.searchParams.showUserInfo.userId;
          assignData.userName = this.searchParams.showUserInfo.fullName;
          assignData.isCurrentEmployee = false;
      },
      chooseEmployee(value){
          if (value != null){
              tiyData.tParams.assignUser.employeeId = value.id;
          } else {
              tiyData.tParams.assignUser.employeeId = "";
          }
      },
      assignToEmployee(userId, userName){ //分配用户给指定员工
          if(!tiyData.tParams.assignUser.employeeId){
              this.$Message.error("请选择推广员！");
              return;
          }
          assignUserToEmployee(this, tiyData, false);
      },
      saveUserTab(){
        let self=this;
        self.$Spin.show();
        let params = {
          tabIds: self.searchParams.showUserInfo.tabList,
          type:2,
          mappingId: self.searchParams.showUserInfo.userId,
        };
        self.$apiOther.updateTabMappings(params).then(response => {
          self.$Spin.hide();
          if(response.success) {
            self.$Message.success("保存成功");
            self.search();
          }else{
            self.$Modal.error(response.errorMessage);
          }
        });
      },
      changeOrderPage(page){
          tiyData.tParams.showOrder.pageNum = page;
          webOrderList(this, tiyData);
      },
      registerType(registerType){
        var way = '邮箱登录';
        this.$store.getters.dictionaries.loginTypeDict.forEach(function (item) {
          if (item.value === registerType) {
            way = item.name;
          }
        });
        return way;
      },
      userDisplayState(state){
        var stateStr = '';
        this.$store.getters.dictionaries.userStateDict.forEach(function (item) {
          if (item.value === state) {
            stateStr = item.name;
            return;
          }
        });
        return stateStr;
      },
      handleCheckAll() {
        let self = this;
        if (this.isCheckedAll) {
          tiyData.tParams.selectedUsers.splice(0);
          for(let i=0;i<this.userList.length;i++){
            tiyData.tParams.selectedUsers.push(this.userList[i].id)
            // self.userSelected.push(this.userList[i].id);
          }
        } else {
          tiyData.tParams.selectedUsers.splice(0);
        }
      },
      checkChange(val) {
        if (tiyData.tParams.selectedUsers.length == this.userList.length) {
          this.isCheckedAll = true;
        } else {
          this.isCheckedAll = false;
        }
      },
      showRecordList(userId){
        this.loginRecord.showRecordDialog=true;
        this.loginRecord.selectedUserId=userId;
      },
      showProductImage(image){
        this.status.modalImage.url = Vue.prototype.$store.getters.imgPrefix + image;
        this.status.modalImage.isShow = true;
      }

    },
    mounted(){
      init(this, tiyData);
      // queryUsersOfCurrentEmployee(this, tiyData);
    },
      filters: {
        numFilter(value) {
          let realVal = (parseFloat(value)/1000).toFixed(3)
          return realVal+"kg"
        }

      }
  }
</script>

<!--css样式-->
<style scoped lang="less">
  @import  (once,optional)  "../css/base.less";

  .table_css {
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .modal_newuser_form {
    padding-left: 60px;
    padding-top: 30px;
    padding-bottom: 30px;
  }

  .modal_newuser_form_input {
    width: 180px;
    margin-right: 10px;

  }
  .info_key {
    color: #9e9e9e;
    font-size: 10px;
  }

</style>
